<?php
    //用户登录
    require '../db.php';

    $username = $_GET["ADM"];
    $email_md5 = $_GET["EMAIL"];

    $conn = connect("bcoh");

    $result = select($conn, "users", "Email", "UserName='$username'");

    if (mysqli_num_rows($result) == 1) {
        $email = mysqli_fetch_assoc($result)["Email"];

        if (!strcmp($email_md5, md5($email))) {
            $pos = strrpos($email, "@");

            $email = substr($email, 0, $pos);

            update($conn, "users", "Email='$email'", "UserName='$username'");

            echo 1;
        } else
            echo 0;
    } else
        echo 0;

    close($conn);
?>